﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Program05
{
    public class Student2
    {
        //学号
        public string No { get; set; }

        //姓名
        public string Name { get; set; }
        private int _age { get; set; }

        public int Age
        {
            get => _age;
            set => _age = value > 150 || value < 0 ? 0 : value;
        }
        //重写Student2的ToString方法
        public override string ToString() => $"学号:{No},姓名:{Name},年龄:{Age}";

    }
}
